package com.thread.test12;

/**
 * @author bin
 * @date 2025 - 03 -13
 **/
public class OneThread extends Thread{
    public static final Object ONE_LOCK = new Object();
    @Override
    public void run() {
        synchronized (ONE_LOCK){
            System.out.printf("获取第一把锁%s，执行相关的业务代码 %n","ONE_LOCK");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

            synchronized (TwoThread.TWO_LOCK){
                System.out.printf("获取第二把锁%s，执行相关的业务代码 $n","TWO_LOCK");
            }
        }
    }
}
